package com.heima.article.task;

import com.heima.article.service.IhotArticleService;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author: itheima
 * @create: 2022-05-25 11:58
 */
@Slf4j
@Component
public class RecentHotArticle {


    @Autowired
    private IhotArticleService ihotArticleService;

    /**
     * 定时任务：计算文章分值将文章缓存到redis中
     */
    @XxlJob("computeHotArticleJob")
    public void computeHotArticleJob(){
      log.info("定时计算热点文章执行了。。。");
        ihotArticleService.compute();
    }
}
